import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:video_setting/pages/utils/loading_widget.dart';

class LoadingUtil {
  static showLoadingDialog({String? text, Color? loadingColor, BuildContext? context}) {
    showDialog<void>(
        context: context ?? Get.context!,
        barrierDismissible: false,
        builder: (BuildContext context) {
          return LoadingWidget(
            text: text,
            bgColor: Colors.white,
            loadingColor: loadingColor,
          );
        });
  }

  static hidenLoadingDialog({BuildContext? context}) {
    context ??= Get.context!;
    FocusScope.of(context).unfocus();
    Navigator.pop(context);
  }
}
